/**
 * @param {string} s
 * @return {number}
 */
var minimumMoves = function (s) {
  let count = 0
  let start = 0
  let len= s.length
  while (start < len) {
    start = s.indexOf('X')
    if (start != -1) {
      count++
      len -= start+3
      s = s.slice(start + 3)
      start=0
    }else return count
  }
  return count
}

console.log(minimumMoves('OOOOXXXOXO'))
